#include "World.h"

// default constructor
World::World() {}

// default destructor, make sure release is called
World::~World() { release(); }

// safetly release all data
void World::release()
{
}

// setup the world
void World::initialize()
{
	m_currentFloor = 0;
	// setup every floor
	for(int i = 0; i < NUM_FLOORS; i++)
		m_floors[i].intialize(0);
}

// update the current floor
void World::update(float dT)
{
	m_floors[m_currentFloor].update(dT);
}

// render the current floor
void World::render()
{
	m_floors[m_currentFloor].render();
}

// set the current floor if the new floor exists
void World::setCurrentFloor(int nFloor)
{
	// make sure the floor exists
	if(nFloor < 0 || nFloor >= NUM_FLOORS)
		return;
	// set the current floor
	m_currentFloor = nFloor;
}

// make sure the floor exists then check
bool World::FloorVisited(int floor)
{
	// make sure the floor exists
	if(floor < 0 || floor >= NUM_FLOORS)
		return false;
	return m_floors[floor].FloorVisited();
}

// make sure the floor exists then check
bool World::FloorCleared(int floor)
{
	// make sure the floor exists
	if(floor < 0 || floor >= NUM_FLOORS)
		return false;
	return m_floors[floor].FloorCleared();
}

// check current floors walls for collision with the given entity
bool World::WallCollision(Entity * entity)
{
	return m_floors[m_currentFloor].WallCollision(entity);
}